package cn.ecut;

import cn.ecut.model.Shenqingdan;
import cn.ecut.service.ShenqingdanService;
import cn.ecut.service.YuangongService;
import com.alibaba.druid.support.json.JSONUtils;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TetShenqiangdan {
    private ShenqingdanService shenqingdanService;
    @Before
    public void init() {
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring.xml");
        shenqingdanService= context.getBean(ShenqingdanService.class);
    }

    @Test
    public void test() {
        System.out.println(shenqingdanService);
        Shenqingdan shenqingdan = new Shenqingdan();
        shenqingdan = shenqingdanService.selectAllByyuangongHao("222222");
        System.out.println(shenqingdan);
    }

    @Test
    public void test2() {
        int n = shenqingdanService.selectAllCountByyuangongHao("222222");
        System.out.println(n);
    }

    @Test
    public void test3(){
        System.out.println(shenqingdanService.getdanjvBianhao());
    }

    @Test
    public void test4() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
        Date date = new Date();
        String s = simpleDateFormat.format(date);
        System.out.println(s);
    }

    @Test
    public void test1() throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
        Date date1 = new Date();
        String s = simpleDateFormat.format(date1);
        System.out.println(s);
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
        Date date2 = sf.parse(s);
        System.out.println(date2);
    }
}
